/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseExceptionEntity.cs
*        创建系统时间:       2012/11/2 19:07:02
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;
    using ECP.Utilities;

    [Serializable]
    public class BaseExceptionEntity
    {
        private string createDate;
        private string createUserID;
        private string createUserRealName;
        private string formattedMessage;
        private string id;
        private string ipAddress;
        private string message;
        private string title;

        public BaseExceptionEntity()
        {
            this.id = string.Empty;
            this.title = string.Empty;
            this.message = string.Empty;
            this.formattedMessage = string.Empty;
            this.ipAddress = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealName = string.Empty;
            this.createDate = string.Empty;
        }

        public BaseExceptionEntity(DataRow dataRow)
        {
            this.id = string.Empty;
            this.title = string.Empty;
            this.message = string.Empty;
            this.formattedMessage = string.Empty;
            this.ipAddress = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealName = string.Empty;
            this.createDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public BaseExceptionEntity(DataTable dataTable)
        {
            this.id = string.Empty;
            this.title = string.Empty;
            this.message = string.Empty;
            this.formattedMessage = string.Empty;
            this.ipAddress = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealName = string.Empty;
            this.createDate = string.Empty;
            this.GetFrom(dataTable);
        }

        public void ClearProperty()
        {
            this.ID = string.Empty;
            this.CreateUserRealName = string.Empty;
        }

        public BaseExceptionEntity GetFrom(DataRow dataRow)
        {
            this.ID = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldID]);
            this.Message = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldMessage]);
            this.FormattedMessage = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldFormattedMessage]);
            this.IPAddress = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldIPAddress]);
            this.CreateDate = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldCreateDate]);
            this.CreateUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldCreateUserID]);
            this.CreateUserRealName = BaseBusinessLogic.ConvertToString(dataRow[BaseExceptionTable.FieldCreateUserRealName]);
            return this;
        }

        public BaseExceptionEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }

        public string CreateDate
        {
            get
            {
                return this.createDate;
            }
            set
            {
                this.createDate = value;
            }
        }

        public string CreateUserID
        {
            get
            {
                return this.createUserID;
            }
            set
            {
                this.createUserID = value;
            }
        }

        public string CreateUserRealName
        {
            get
            {
                return this.createUserRealName;
            }
            set
            {
                this.createUserRealName = value;
            }
        }

        public string FormattedMessage
        {
            get
            {
                return this.formattedMessage;
            }
            set
            {
                this.formattedMessage = value;
            }
        }

        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public string IPAddress
        {
            get
            {
                return this.ipAddress;
            }
            set
            {
                this.ipAddress = value;
            }
        }

        public string Message
        {
            get
            {
                return this.message;
            }
            set
            {
                this.message = value;
            }
        }

        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }
    }
}